package iedcyt.acute.dataAccess.factories;


import iedcyt.acute.dataAccess.dao.maescorp.MaescorpWoSDao;
import iedcyt.acute.dataAccess.idao.IDao;
import iedcyt.acute.dataAccess.idao.maescorp.IMaescorpWoSDao;
import iedcyt.acute.dataAccess.utils.BeansXML;
import iedcyt.acute.dataAccess.utils.Parameters;

import javax.security.auth.login.Configuration;

import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

public class AbsMaescorpWoSFactoryDao extends AbsFactoryDao {

	private static AbsMaescorpWoSFactoryDao _instance;

	private IMaescorpWoSDao _MaescorpWoSDao;

	private AbsMaescorpWoSFactoryDao()
	{super();
		startDaos();
		
	}
	

	public static AbsMaescorpWoSFactoryDao getInstance()
	{
		if (_instance == null) _instance = new AbsMaescorpWoSFactoryDao();
		
		return _instance;
	}

	
	
	public IMaescorpWoSDao get_MaescorpWoSDao() {
		return _MaescorpWoSDao;
	}


	@Override
	protected IDao getIDao() {
		return _MaescorpWoSDao;
	}


	/**
	 * @see iedcyt.acute.dataAccess.factories.AbsFactoryDao#startDaos()
	 */
	@Override
	public void startDaos() {
		AbstractApplicationContext _context = new FileSystemXmlApplicationContext(Parameters.get_instance().getBeanFile());
		_context.registerShutdownHook();
			
		_MaescorpWoSDao = (MaescorpWoSDao) _context.getBean("maescorpWoSDao");
		
	}

	/**
	 * @see iedcyt.acute.dataAccess.factories.AbsFactoryDao#getPath()
	 */
	@Override
	public String getPath() {
		return BeansXML.getInstance().getDatabasePath("maescorpWoSDataSource");
		
	}
	
}
